package cn.online.taxi.driver.user.service.service.impl;

import cn.online.taxi.common.exception.OnlineTaxiException;
import cn.online.taxi.driver.user.service.service.DriverInfoService;
import cn.online.taxi.manager.mapper.TbDriverMapper;
import cn.online.taxi.manager.pojo.TbDriver;
import com.alibaba.dubbo.config.annotation.Service;

import javax.annotation.Resource;

/**
 * @Author BinBini
 * @Date 2021/4/26 9:46
 * @Version 1.0
 */
@Service
public class DriverInfoServiceImpl implements DriverInfoService {

    @Resource
    private TbDriverMapper tbDriverMapper;

    @Override
    public TbDriver getDriverById(Integer id) {
        TbDriver tbDriver;
        try {
            tbDriver = tbDriverMapper.selectByPrimaryKey(id);
        }catch (Exception e) {
            throw new OnlineTaxiException("ID获取司机信息失败");
        }
        tbDriver.setPassword("");
        return tbDriver;
    }
}
